# Figure 3

#####
rm(list=ls(all=TRUE))

library(MASS)
library(sjPlot)
library(tidyverse)

#### Dataset Original ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Data Rep")
load("data_empirics_length_rep.Rdata")

## This variable started giving me errors becacuse of the \n character
data_empirics_length$interruption_cat <- as.factor(data_empirics_length$interruption_cat)

## Predicted length of speech

model_6.0.cat <- glm.nb(length_speech_combined_session ~ female_dum + ideology_ext + 
                          committee_chair + seniority + type_member +
                          party_match_pres + 
                          election_year  +
                          mean_length_leg +
                          negative_lang_leg_session + dum_mujeres_session +
                          female_dum*interruption_cat +
                          factor(cohort), 
                        data = data_empirics_length)

setup_cat <- plot_model(model_6.0.cat, type = "pred", terms = c("interruption_cat","female_dum")) +
  labs(x = "", y = "Predicted Length of Speech",
       title = "Predicted Length of Speech When Interrupted") +
  theme(legend.position="bottom")
setup_cat

#### FIGURE: Setup for strategic: #####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Figures")
ggsave("figure3.pdf", width = 8, height = 6)
